package com.example.beauty.controller;

import com.example.beauty.entity.Image;
import com.example.beauty.resp.RespModel;
import com.example.beauty.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author qin
 * @create 2022--09--06--16:42
 * http://localhost:8080/image/byType
 * @Controller 控制层
 * @ResponseBody  以json格式返回数据
 * @RestController 相当于   @Controller + @ResponseBody
 * @GetMapping  查
 * @postmapping   增
 * @DeleteMapping  删
 * @PutMapping  该
 *
 *
 */
@RestController
@RequestMapping("/image")
public class ImageController {
    @Resource
    private ImageService imageService;
//    @RequestMapping("/byType")
//    @GetMapping("/byType/{type}/{name}")
//    public List<Image> getImageByType(@PathVariable("type") String type, @PathVariable("name") String name){
//        System.out.println("type:"+type+"，name:"+name);
//
//        return imageService.getImageByType(type);
//    }

    @GetMapping("/byType")
    public RespModel getImageByType(String type){

        return imageService.getImageByType(type);
    }
}
